<%--
  Created by IntelliJ IDEA.
  User: 娅娅
  Date: 2021/8/6
  Time: 11:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>停车场车位租赁管理系统</title>
</head>
<body >

<form action="${pageContext.request.contextPath }/rent/list" method="post" >
    <table>
        <tr>
            <td>
                租赁人姓名:<input type="text" name="userName">
                租赁状态：
                <select name = "status">
                    <option value="0">租赁中</option>
                    <option value="1">已到期</option>
                </select>
                <input type="submit" value="搜索">
            </td>
        </tr>
    </table>
</form>
<table style="background: aliceblue" >
    <tr>
        <td colspan="5" align="center"><h2>停车场车位租赁管理系统</h2></td>
    </tr>
    <tr>
        <td colspan="5"><a href="${pageContext.request.contextPath }/rent/toAdd"><button>车位租赁</button></a></td>
    </tr>
    <tr style="background: cadetblue">
        <th align="left">租赁人姓名</th>
        <th>车牌号</th>
        <th>租赁状态</th>
        <th>到期日期</th>
        <th>操作</th>
    </tr>
    <c:forEach var="r" items="${rent}" >
        <tr>
            <td>${r.userName}</td>
            <td>${r.carNum}</td>
            <td>
                <c:if test="${r.status==0}">租赁中</c:if>
                <c:if test="${r.status==1}">已到期</c:if>
            </td>
            <td>${r.maturityDate}</td>
            <td>
                <a href="UpdateServlet?id=${r.id}&status=${r.status}">${r.status==0?"退租":"已到期"}</a>
                <a href="${pageContext.request.contextPath }/rent/del?id=${r.id}" >删除</a>
            </td>
        </tr>
    </c:forEach>
    <p>${info}</p>
</table>
</body>
</html>

